package com.bipa.controller;

import com.bipa.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class DetailController {

    @Autowired
    ArticleService articleService;

    @RequestMapping("/detail")
    public ModelAndView showDetail(@RequestParam("id") Integer id){
        ModelAndView mv = new ModelAndView();
        mv.addObject("article",articleService.getArticleById(id));
        mv.setViewName("front/detial");
        return mv;
    }
}
